package team.fivez.defaultmanage.dao.Impl;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import team.fivez.defaultmanage.dao.HaveDefaultReasonDao;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class HaveDefaultReasonDaoImpl implements HaveDefaultReasonDao {

    @Resource
    private JdbcTemplate jdbcTemplate;

    @Override
    public void insertOneHave(String applicationNumber, int defaultReasonNumber) {
        String sql="insert into have_default_reason values(?,?)";
        jdbcTemplate.update(sql,defaultReasonNumber,applicationNumber);
    }

    @Override
    public List<Integer> selectAllReasonByApplicationNumber(String applicationNumber) {
        String sql="select default_reason_number from have_default_reason where default_application_number=?";
        return jdbcTemplate.queryForList(sql,Integer.class,applicationNumber);
    }
}
